package com.saint.lt.service.propertyeditors;

import java.beans.PropertyEditorSupport;

import com.saint.lt.domain.User;
import com.saint.lt.service.UserService;

public final class UserFromString extends PropertyEditorSupport {
	
	private UserService userService;
	
	public UserFromString(UserService userService) {
		this.userService = userService;
	}

    @Override
    public void setAsText(String text) throws IllegalArgumentException {
        User result = userService.get(text);
        this.setValue(result);
    }
}